using System;
using ContactCenter.Core.DomainModel;
using ContactCenter.Core.Exceptions;

namespace ContactCenter.Core.Common
{
    public static class ValidationHelper
    {
        public static void ValidateCreditCard(CreditCard creditCard)
        {
            if (string.IsNullOrEmpty(creditCard.PublicPart) || string.IsNullOrEmpty(creditCard.PrivatePart))
            {
                throw new InvalidCreditCardException("The credit card specified has invalid data!");
            }
            
            if (creditCard.ExpirationDate < DateTime.Today)
            {
                throw new InvalidCreditCardException("The credit card specified has expired!");
            }
        }

        public static void ValidateContactInfo(ContactInfo contactInfo)
        {
            if (string.IsNullOrEmpty(contactInfo.EMail))
            {
                throw new InvalidContactInfoException("The contact has invalid email!");
            }
        }
    }
}